Multi-file Swift Output - #1221
Conversation
It’s not strictly true unless you also specify Objective-C support, but harmless nonetheless.
|
Throwing an informal |
…o/new/multi-file-output # Conflicts: # src/quicktype-core/language/Swift.ts
|
Looks like the emitted code is incorrect: |
|
|
…o/new/multi-file-output # Conflicts: # src/quicktype-core/language/Swift.ts
schani
left a comment
There was a problem hiding this comment.
Can this still produce one-file output? That should be the default. We have many users of quicktype with Swift who I'm sure depend on the current behavior. Sorry I didn't point this out earlier.
|
|
@schani I should be able to make single file output the default, yes. I'll get that fixed up. Thanks for posting those errors. I'll be interested in seeing how the latest push works, those tests all pass locally for me. |
|
What failed here is another test we do: It generates JSON Schema from the input JSON, and then it generates Swift from the JSON Schema, and diffs that Swift output with the one coming directly from the input JSON. Ideally those should be identical, but here's a case where they differ. Could you look into that, please? As you can see in |
|
I'm on it, thanks @schani |
|
One thing that jumps out right away is that the header is added multiple times per file. That should be fixed. I haven't looked at it in more detail apart from that. |
|
Awesome, thank you! |
Reason to Be
When running quicktype to generate Swift code from a directory of schema files the output currently dumps everything into a single
.swiftfile. This PR breaks each named type out into its own file. Additionally it generates aJSONSchemaSupport.swiftthat contains many of the helper functions needed by the various outputs.Resolves #687
CHANGELOG Entry
Thought Process
After seeing that the Java renderer already does this exact thing and digging into how quicktype writes its files I began refactoring the renderer to divide up the generated source into sensible blocks.
How To Test
Testing manually should be as simple as:
Possible Impacts
I know for a fact that I've broken the rendering of one of the schema inputs. shakes fist at
keyword-unions.schemaI'll be working to get that fixed up…somehow.